//
//  LTView.m
//  UI10_homework通讯录UI
//
//  Created by dllo on 16/6/19.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LTView.h"

@interface LTView ()<UITextFieldDelegate>

@end

@implementation LTView


-(instancetype)initWithFrame:(CGRect)frame withLabelText:(NSString *)labelText withFieldText:(NSString *)fieldText{
    
    if (self = [super initWithFrame:frame]) {
        self.label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.bounds) / 3, CGRectGetHeight(self.bounds))];
        self.label.textAlignment = 1;
        self.label.layer.borderWidth = 0.5;
        self.label.layer.cornerRadius = 8;
        self.label.text = labelText;
        [self addSubview:_label];
        [_label release];
        
        self.textField = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.bounds) / 3, 0, CGRectGetWidth(self.bounds) / 3 * 2, CGRectGetHeight(self.bounds))];
        self.textField.text = fieldText;
        self.textField.layer.borderWidth = 0.5;
        self.textField.layer.cornerRadius = 8;
        self.textField.textAlignment = 1;
        [self addSubview:_textField];
        [_textField release];
        self.textField.delegate = self;
        
    }
    
    
    return self;
    
    
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}


@end
